package com.tianqu.tms.www.cardect.controller;

import java.util.List;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsController;
import com.tianqu.tms.core.base.TxController;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.exception.TmsException;
import com.tianqu.tms.core.exception.TransactionException;
import com.tianqu.tms.core.util.StringUtil;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.DectCodes;
import com.tianqu.tms.entity.TmsDetectInfo;
import com.tianqu.tms.entity.TmsDetectNormal;
import com.tianqu.tms.entity.TmsDetectPic;
import com.tianqu.tms.www.cardect.viewhelper.CarNormalDetectViewHelper;

/**
 * 待检测（人工）列表页进入普通检测详细页Controller
 * 
 * 存两份viewhelp，一份用于查看页面，一份用于修改页面
 * 
 * @author tianshifu
 * 
 */
public class CarWDPersonNDInfoDetailController extends TmsController {
	private Logger logger = Logger
			.getLogger(CarWDPersonNDInfoDetailController.class);// log
	private static final String CARSERIAL = "carSerial";// 页面传过来的车辆ID
	// private static final String CHKMODEL = "chkModel";//检测模式
	private static final String CARDETECTID = "carDetectId";// 检测报告ID
	private static final String DETECT_INPUT_DATA = "detect_input_data";// 检测录入信息
	private static final String IMGLIST = "imgList";// 用于存放图片对象的list

	@Override
	public void execute(UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");
		TxController controller = TxController.getTxController();

		// 添加事务提交异常捕获
		try {
			controller.begin();
			// 从tis_car_info表中取出基本信息，八大配置，行驶里程，检测ID和检测模式
			String carSerial = (String) uc.getAttribute(CARSERIAL);
			// String chkModel = (String)uc.getAttribute(CHKMODEL);
			int carDetectId = (Integer) uc.getAttribute(CARDETECTID);

			CarNormalDetectViewHelper view = new CarNormalDetectViewHelper();// 用于详细页viewhelp

			TmsDetectInfo carEntity = TmsDetectInfo.getInstance();
			carEntity = carEntity.getWDIpadCarInfoBySerial(carSerial, 3);// 获取存在基本表中的检测信息
			// 将基本表中的数据set到viewhelp中

			view = setViewhelpFromCarEntity(view, carEntity);// 将tis_car_info表数据set到viewhelp中

			view.setBidStatus(String.valueOf(carEntity.getBidStatus()));

			TmsDetectNormal decEntity = TmsDetectNormal.getInstance();
			decEntity = decEntity.findDetectNormalInfoById(carDetectId);// 根据检测ID查询出该车辆基本检测信息
			// 将基本表中的数据set到viewhelp中,需要将空值给个默认值 StringUtil.transNullStr
			view = setViewhelpFromDecEntity(view, decEntity);
            view.setSerial(carSerial);
			/****** 用于修改页viewhelp ******/
			CarNormalDetectViewHelper updateView = new CarNormalDetectViewHelper();// 用于详细页viewhelp
			updateView = setUpdateViewhelpFromCarEntity(updateView, carEntity);// 将tis_car_info表数据set到viewhelp中

			updateView = setUpdateViewhelpFromDecEntity(updateView, decEntity);// 检测信息

			uc.removeAttribute(DETECT_INPUT_DATA);// 有的话就直接removed掉
			uc.setAttribute(DETECT_INPUT_DATA, updateView);// 用于修改页面,修改页面和查看页面只有上面的八大配置不同

			// 根据检测ID查询车辆图片信息
			TmsDetectPic picEntity = TmsDetectPic.getInstance();
			// 需要传递一个图片类型 imgType 1为整体图片 2为检测图片
			List<TmsDetectPic> picListType1 = picEntity
					.findDetectPicInfoByDetectIdAndImgType(carDetectId, 1);// 整体

			List<TmsDetectPic> picListType2 = picEntity
					.findDetectPicInfoByDetectIdAndImgType(carDetectId, 2);// 具体位置检测图片

			List<TmsDetectPic> picAllList = picEntity
					.findDetectPicInfoByDetectId(carDetectId);
			// 如果整体图片为空 则赋空
			if (picListType1 != null) {
				for (int i = 0; i < picListType1.size(); i++) {
					// 将图片信息set到viewhelp中
					picEntity = picListType1.get(i);
					setPicViewFromEntity(view, picEntity);

				}
			} else {
				// 没有图片
				view.setImg01("");
				view.setImgType("");
				view.setImg02("");
				view.setImgType("");
				view.setImg03("");
				view.setImgType("");
				view.setImg04("");
				view.setImgType("");
				view.setImg05("");
				view.setImgType("");
				view.setImg06("");
				view.setImgType("");
				view.setImg07("");
				view.setImgType("");
				view.setImg08("");
				view.setImgType("");
				view.setImg09("");
				view.setImgType("");
			}
			// 具体检测位置图片信息
			if (picListType2 != null) {
				for (int i = 0; i < picListType2.size(); i++) {
					// 将图片信息set到viewhelp中
					picEntity = picListType2.get(i);
					setPicViewFromEntity(view, picEntity);

				}
			} else {
				// 没有图片
				view.setImg1("");
				view.setImg2("");
				view.setImg3("");
				view.setImg4("");
				view.setImg5("");
				view.setImg6("");
				view.setImg7("");
				view.setImg8("");
				view.setImg9("");
				view.setImg10("");
				view.setImg11("");
				view.setImg12("");
				view.setImg13("");
				view.setImg14("");
				view.setImg15("");
				view.setImg16("");
				view.setImg17("");
				view.setImg18("");
				view.setImg19("");
				view.setImg20("");
				view.setImg21("");
				view.setImg22("");
				view.setImg23("");
				view.setImg24("");
				view.setImg25("");
				view.setImg26("");
				view.setImg27("");
				view.setImg28("");
				view.setImg29("");
				view.setImg30("");
				view.setImg31("");
				view.setImg32("");
				view.setImg33("");
				view.setImg34("");
				view.setImg35("");
				view.setImg36("");
				view.setImg37("");
				view.setImg38("");
				view.setImg39("");
				view.setImg40("");
				view.setImg41("");
				view.setImg42("");
				view.setImg43("");
				view.setImg44("");
				view.setImg45("");
				view.setImg46("");
				view.setImg47("");
				view.setImg48("");
				view.setImg49("");
				view.setImg50("");
				view.setImg51("");
				view.setImg52("");
				view.setImg53("");
				view.setImg54("");
				view.setImg55("");
				view.setImg56("");
				view.setImg57("");
				view.setImg58("");
				view.setImg59("");
				view.setImg60("");
				view.setImg61("");
				view.setImg62("");
				view.setImg63("");
				view.setImg64("");
				view.setImg65("");

			}
			// 将图片list放到uc中等待调用
			uc.setAttribute(IMGLIST, picAllList);// 还需要一个整体图片+具体检测位置图片

			uc.removeAttribute(TmsConstants.VIEWHELP);// 有的话就直接removed掉
			uc.setAttribute(TmsConstants.VIEWHELP, view);// 用于信息查看页打出
			controller.commit();
		} catch (Exception e) {
			try {
				controller.rollback();
			} catch (TransactionException e1) {
				throw new TmsException(TmsException.DB_TXCRROR, e1);
			}
			// 系统异常
			if (e instanceof TmsException) {
				throw e;
			}
			throw new TmsException(TmsException.DB_TXCRROR, e);
		}

		logger.debug(this.getClass().getName() + "#doAction was completed.");

	}

	/***
	 * 
	 * 将图片信息从entity set到viewhelp中
	 * 
	 */
	private CarNormalDetectViewHelper setPicViewFromEntity(
			CarNormalDetectViewHelper view, TmsDetectPic entity) {

		if (entity.getImgType() == 1)// 整体图片
		{
			if (entity.getImgKey().equals("1")) {
				view.setImg01(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("2")) {
				view.setImg02(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("3")) {
				view.setImg03(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("4")) {
				view.setImg04(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("5")) {
				view.setImg05(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("6")) {
				view.setImg06(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("7")) {
				view.setImg07(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("8")) {
				view.setImg08(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
			if (entity.getImgKey().equals("9")) {
				view.setImg09(entity.getImgPath());
				view.setImgType(String.valueOf(entity.getImgType()));
			}
		}
		if (entity.getImgType() == 2)// 检测图片
		{
			if (entity.getImgKey().equals("1")) {
				view.setImg1(entity.getImgPath());
			}
			if (entity.getImgKey().equals("2")) {
				view.setImg2(entity.getImgPath());
			}
			if (entity.getImgKey().equals("3")) {
				view.setImg3(entity.getImgPath());
			}
			if (entity.getImgKey().equals("4")) {
				view.setImg4(entity.getImgPath());
			}
			if (entity.getImgKey().equals("5")) {
				view.setImg5(entity.getImgPath());
			}
			if (entity.getImgKey().equals("6")) {
				view.setImg6(entity.getImgPath());
			}
			if (entity.getImgKey().equals("7")) {
				view.setImg7(entity.getImgPath());
			}
			if (entity.getImgKey().equals("8")) {
				view.setImg8(entity.getImgPath());
			}
			if (entity.getImgKey().equals("9")) {
				view.setImg9(entity.getImgPath());
			}
			if (entity.getImgKey().equals("10")) {
				view.setImg10(entity.getImgPath());
			}
			if (entity.getImgKey().equals("11")) {
				view.setImg11(entity.getImgPath());
			}
			if (entity.getImgKey().equals("12")) {
				view.setImg12(entity.getImgPath());
			}
			if (entity.getImgKey().equals("13")) {
				view.setImg13(entity.getImgPath());
			}
			if (entity.getImgKey().equals("14")) {
				view.setImg14(entity.getImgPath());
			}
			if (entity.getImgKey().equals("15")) {
				view.setImg15(entity.getImgPath());
			}
			if (entity.getImgKey().equals("16")) {
				view.setImg16(entity.getImgPath());
			}
			if (entity.getImgKey().equals("17")) {
				view.setImg17(entity.getImgPath());
			}
			if (entity.getImgKey().equals("18")) {
				view.setImg18(entity.getImgPath());
			}
			if (entity.getImgKey().equals("19")) {
				view.setImg19(entity.getImgPath());
			}
			if (entity.getImgKey().equals("20")) {
				view.setImg20(entity.getImgPath());
			}
			if (entity.getImgKey().equals("21")) {
				view.setImg21(entity.getImgPath());
			}
			if (entity.getImgKey().equals("22")) {
				view.setImg22(entity.getImgPath());
			}
			if (entity.getImgKey().equals("23")) {
				view.setImg23(entity.getImgPath());
			}
			if (entity.getImgKey().equals("24")) {
				view.setImg24(entity.getImgPath());
			}
			if (entity.getImgKey().equals("25")) {
				view.setImg25(entity.getImgPath());
			}
			if (entity.getImgKey().equals("26")) {
				view.setImg26(entity.getImgPath());
			}
			if (entity.getImgKey().equals("27")) {
				view.setImg27(entity.getImgPath());
			}
			if (entity.getImgKey().equals("28")) {
				view.setImg28(entity.getImgPath());
			}
			if (entity.getImgKey().equals("29")) {
				view.setImg29(entity.getImgPath());
			}
			if (entity.getImgKey().equals("30")) {
				view.setImg30(entity.getImgPath());
			}
			if (entity.getImgKey().equals("31")) {
				view.setImg31(entity.getImgPath());
			}
			if (entity.getImgKey().equals("32")) {
				view.setImg32(entity.getImgPath());
			}
			if (entity.getImgKey().equals("33")) {
				view.setImg33(entity.getImgPath());
			}
			if (entity.getImgKey().equals("34")) {
				view.setImg34(entity.getImgPath());
			}
			if (entity.getImgKey().equals("35")) {
				view.setImg35(entity.getImgPath());
			}
			if (entity.getImgKey().equals("36")) {
				view.setImg36(entity.getImgPath());
			}
			if (entity.getImgKey().equals("37")) {
				view.setImg37(entity.getImgPath());
			}
			if (entity.getImgKey().equals("38")) {
				view.setImg38(entity.getImgPath());
			}
			if (entity.getImgKey().equals("39")) {
				view.setImg39(entity.getImgPath());
			}
			if (entity.getImgKey().equals("40")) {
				view.setImg40(entity.getImgPath());
			}
			if (entity.getImgKey().equals("41")) {
				view.setImg41(entity.getImgPath());
			}
			if (entity.getImgKey().equals("42")) {
				view.setImg42(entity.getImgPath());
			}
			if (entity.getImgKey().equals("43")) {
				view.setImg43(entity.getImgPath());
			}
			if (entity.getImgKey().equals("44")) {
				view.setImg44(entity.getImgPath());
			}
			if (entity.getImgKey().equals("45")) {
				view.setImg45(entity.getImgPath());
			}
			if (entity.getImgKey().equals("46")) {
				view.setImg46(entity.getImgPath());
			}
			if (entity.getImgKey().equals("47")) {
				view.setImg47(entity.getImgPath());
			}
			if (entity.getImgKey().equals("48")) {
				view.setImg48(entity.getImgPath());
			}
			if (entity.getImgKey().equals("49")) {
				view.setImg49(entity.getImgPath());
			}
			if (entity.getImgKey().equals("50")) {
				view.setImg50(entity.getImgPath());
			}
			if (entity.getImgKey().equals("51")) {
				view.setImg51(entity.getImgPath());
			}
			if (entity.getImgKey().equals("52")) {
				view.setImg52(entity.getImgPath());
			}
			if (entity.getImgKey().equals("53")) {
				view.setImg53(entity.getImgPath());
			}
			if (entity.getImgKey().equals("54")) {
				view.setImg54(entity.getImgPath());
			}
			if (entity.getImgKey().equals("55")) {
				view.setImg55(entity.getImgPath());
			}
			if (entity.getImgKey().equals("56")) {
				view.setImg56(entity.getImgPath());
			}
			if (entity.getImgKey().equals("57")) {
				view.setImg57(entity.getImgPath());
			}
			if (entity.getImgKey().equals("58")) {
				view.setImg58(entity.getImgPath());
			}
			if (entity.getImgKey().equals("59")) {
				view.setImg59(entity.getImgPath());
			}
			if (entity.getImgKey().equals("60")) {
				view.setImg60(entity.getImgPath());
			}
			if (entity.getImgKey().equals("61")) {
				view.setImg61(entity.getImgPath());
			}
			if (entity.getImgKey().equals("62")) {
				view.setImg62(entity.getImgPath());
			}
			if (entity.getImgKey().equals("63")) {
				view.setImg63(entity.getImgPath());
			}
			if (entity.getImgKey().equals("64")) {
				view.setImg64(entity.getImgPath());
			}
			if (entity.getImgKey().equals("65")) {
				view.setImg65(entity.getImgPath());
			}
		}
		return view;
	}

	/**
	 * 
	 * 将存在基本表中的检测信息set到viewhelp中
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	private CarNormalDetectViewHelper setViewhelpFromCarEntity(
			CarNormalDetectViewHelper view, TmsDetectInfo entity)
			throws TmsDaoException {
		// 八大配置，，检测说明
		// view.setChkModel(chkModel)//检测模式
		view.setMileage(String.valueOf(entity.getMileage()));// 表显里程
		view.setCarDescribe(entity.getCarDescribe());// 检测说明
		/******* 八大配置 **********/
		DectCodes code = DectCodes.getInstance();
		view.setSkylight(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getSkylight())));
		view.setLeatherSeats(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getLeatherSeats())));
		view.setAluminumRim(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getAluminumRim())));
		view.setGpsNavigation(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getGpsNavigation())));
		view.setAutoWindow(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getAutoWindow())));
		view.setAbs(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getAbs())));
		view.setSrsNumber(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getSrsNumber())));
		view.setFourWheelDrive(code.getItemValueByItemIdAndItemCode(
				DectCodes.EIGHT_VEHICLE_CONFIGURATION, String.valueOf(entity
						.getFourWheelDrive())));

		return view;
	}

	/**
	 * 将基本检测信息set到viewhelp中,详细页
	 * 
	 * 如果为空，则给个默认值“-”
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	private CarNormalDetectViewHelper setViewhelpFromDecEntity(
			CarNormalDetectViewHelper view, TmsDetectNormal entity)
			throws TmsDaoException {
		DectCodes code = DectCodes.getInstance();
		view.setDisasterCars(code.getItemValueByItemIdAndItemCode(
				DectCodes.TRAFFIC_CAR, entity.getDisasterCars()));// 事故车
		/** 一、左前门检测 *********/
		view.setFrontLeftChk1(StringUtil
				.transNullStr(entity.getFrontLeftChk1()));
		view.setFrontLeftChk2(StringUtil
				.transNullStr(entity.getFrontLeftChk2()));
		view.setFrontLeftChk3(StringUtil
				.transNullStr(entity.getFrontLeftChk3()));
		view.setFrontLeftChk4(StringUtil
				.transNullStr(entity.getFrontLeftChk4()));
		view.setFrontLeftChk5(StringUtil
				.transNullStr(entity.getFrontLeftChk5()));
		view.setFrontLeftChk6(StringUtil
				.transNullStr(entity.getFrontLeftChk6()));
		view.setFrontLeftChk7(StringUtil
				.transNullStr(entity.getFrontLeftChk7()));
		view.setFrontLeftChk8(StringUtil
				.transNullStr(entity.getFrontLeftChk8()));
		view.setFrontLeftChk9(StringUtil
				.transNullStr(entity.getFrontLeftChk9()));
		/******************************/
		/** 二、内饰检测 **/
		view.setInsideChk1(StringUtil.transNullStr(entity.getInsideChk1()));
		view.setInsideChk2(StringUtil.transNullStr(entity.getInsideChk2()));
		view.setInsideChk3(StringUtil.transNullStr(entity.getInsideChk3()));
		view.setInsideChk4(StringUtil.transNullStr(entity.getInsideChk4()));
		view.setInsideChk5(StringUtil.transNullStr(entity.getInsideChk5()));
		view.setInsideChk6(StringUtil.transNullStr(entity.getInsideChk6()));
		view.setInsideChk7(StringUtil.transNullStr(entity.getInsideChk7()));
		view.setInsideChk8(StringUtil.transNullStr(entity.getInsideChk8()));
		view.setInsideChk9(StringUtil.transNullStr(entity.getInsideChk9()));
		view.setInsideChk10(StringUtil.transNullStr(entity.getInsideChk10()));
		view.setInsideChk11(StringUtil.transNullStr(entity.getInsideChk11()));
		view.setInsideChk12(StringUtil.transNullStr(entity.getInsideChk12()));
		view.setInsideChk13(StringUtil.transNullStr(entity.getInsideChk13()));
		view.setInsideChk14(StringUtil.transNullStr(entity.getInsideChk14()));
		view.setInsideChk15(StringUtil.transNullStr(entity.getInsideChk15()));
		view.setInsideChk16(StringUtil.transNullStr(entity.getInsideChk16()));
		view.setInsideChk17(StringUtil.transNullStr(entity.getInsideChk17()));
		view.setInsideChk18(StringUtil.transNullStr(entity.getInsideChk18()));
		view.setInsideChk19(StringUtil.transNullStr(entity.getInsideChk19()));
		view.setInsideChk20(StringUtil.transNullStr(entity.getInsideChk20()));
		view.setInsideChk21(StringUtil.transNullStr(entity.getInsideChk21()));
		view.setInsideChk22(StringUtil.transNullStr(entity.getInsideChk22()));
		view.setInsideChk23(StringUtil.transNullStr(entity.getInsideChk23()));
		view.setInsideChk24(StringUtil.transNullStr(entity.getInsideChk24()));
		view.setInsideChk25(StringUtil.transNullStr(entity.getInsideChk25()));
		view.setInsideChk26(StringUtil.transNullStr(entity.getInsideChk26()));
		view.setInsideChk27(StringUtil.transNullStr(entity.getInsideChk27()));
		view.setInsideChk28(StringUtil.transNullStr(entity.getInsideChk28()));
		view.setInsideChk29(StringUtil.transNullStr(entity.getInsideChk29()));
		view.setInsideChk30(StringUtil.transNullStr(entity.getInsideChk30()));
		/******************************/
		/** 三、左前翼子板检测 **/
		view.setPanelFenerLhChk1(StringUtil.transNullStr(entity
				.getPanelFenerLhChk1()));
		view.setPanelFenerLhChk2(StringUtil.transNullStr(entity
				.getPanelFenerLhChk2()));
		view.setPanelFenerLhChk3(StringUtil.transNullStr(entity
				.getPanelFenerLhChk3()));
		view.setPanelFenerLhChk4(StringUtil.transNullStr(entity
				.getPanelFenerLhChk4()));
		view.setPanelFenerLhChk5(StringUtil.transNullStr(entity
				.getPanelFenerLhChk5()));
		view.setPanelFenerLhChk6(StringUtil.transNullStr(entity
				.getPanelFenerLhChk6()));
		/******************************/
		/** 四、正前面检测 **/
		view.setDeadAheadChk1(StringUtil
				.transNullStr(entity.getDeadAheadChk1()));
		view.setDeadAheadChk2(StringUtil
				.transNullStr(entity.getDeadAheadChk2()));
		view.setDeadAheadChk3(StringUtil
				.transNullStr(entity.getDeadAheadChk3()));
		view.setDeadAheadChk4(StringUtil
				.transNullStr(entity.getDeadAheadChk4()));
		view.setDeadAheadChk5(StringUtil
				.transNullStr(entity.getDeadAheadChk5()));
		view.setDeadAheadChk6(StringUtil
				.transNullStr(entity.getDeadAheadChk6()));
		/******************************/
		/** 五、发动机舱内检测 **/
		view.setEngineChk1(StringUtil.transNullStr(entity.getEngineChk1()));
		view.setEngineChk2(StringUtil.transNullStr(entity.getEngineChk2()));
		view.setEngineChk3(StringUtil.transNullStr(entity.getEngineChk3()));
		view.setEngineChk4(StringUtil.transNullStr(entity.getEngineChk4()));
		view.setEngineChk5(StringUtil.transNullStr(entity.getEngineChk5()));
		view.setEngineChk6(StringUtil.transNullStr(entity.getEngineChk6()));
		view.setEngineChk7(StringUtil.transNullStr(entity.getEngineChk7()));
		view.setEngineChk8(StringUtil.transNullStr(entity.getEngineChk8()));
		/******************************/
		/** 六、右前翼子板检测 **/
		view.setPanelFenerRhChk1(StringUtil.transNullStr(entity
				.getPanelFenerRhChk1()));
		view.setPanelFenerRhChk2(StringUtil.transNullStr(entity
				.getPanelFenerRhChk2()));
		view.setPanelFenerRhChk3(StringUtil.transNullStr(entity
				.getPanelFenerRhChk3()));
		view.setPanelFenerRhChk4(StringUtil.transNullStr(entity
				.getPanelFenerRhChk4()));
		view.setPanelFenerRhChk5(StringUtil.transNullStr(entity
				.getPanelFenerRhChk5()));
		view.setPanelFenerRhChk6(StringUtil.transNullStr(entity
				.getPanelFenerRhChk6()));
		/******************************/
		/** 七、右前门检测 **/
		view.setFrontRightChk1(StringUtil.transNullStr(entity
				.getFrontRightChk1()));
		view.setFrontRightChk2(StringUtil.transNullStr(entity
				.getFrontRightChk2()));
		view.setFrontRightChk3(StringUtil.transNullStr(entity
				.getFrontRightChk3()));
		view.setFrontRightChk4(StringUtil.transNullStr(entity
				.getFrontRightChk4()));
		view.setFrontRightChk5(StringUtil.transNullStr(entity
				.getFrontRightChk5()));
		view.setFrontRightChk6(StringUtil.transNullStr(entity
				.getFrontRightChk6()));
		view.setFrontRightChk7(StringUtil.transNullStr(entity
				.getFrontRightChk7()));
		view.setFrontRightChk8(StringUtil.transNullStr(entity
				.getFrontRightChk8()));
		view.setFrontRightChk9(StringUtil.transNullStr(entity
				.getFrontRightChk9()));
		view.setFrontRightChk10(StringUtil.transNullStr(entity
				.getFrontRightChk10()));
		view.setFrontRightChk11(StringUtil.transNullStr(entity
				.getFrontRightChk11()));
		view.setFrontRightChk12(StringUtil.transNullStr(entity
				.getFrontRightChk12()));
		view.setFrontRightChk13(StringUtil.transNullStr(entity
				.getFrontRightChk13()));
		/******************************/
		/** 八、右后门检测 **/
		view.setRearRightChk1(StringUtil
				.transNullStr(entity.getRearRightChk1()));
		view.setRearRightChk2(StringUtil
				.transNullStr(entity.getRearRightChk2()));
		view.setRearRightChk3(StringUtil
				.transNullStr(entity.getRearRightChk3()));
		view.setRearRightChk4(StringUtil
				.transNullStr(entity.getRearRightChk4()));
		view.setRearRightChk5(StringUtil
				.transNullStr(entity.getRearRightChk5()));
		view.setRearRightChk6(StringUtil
				.transNullStr(entity.getRearRightChk6()));
		view.setRearRightChk7(StringUtil
				.transNullStr(entity.getRearRightChk7()));
		view.setRearRightChk8(StringUtil
				.transNullStr(entity.getRearRightChk8()));
		view.setRearRightChk9(StringUtil
				.transNullStr(entity.getRearRightChk9()));
		view.setRearRightChk10(StringUtil.transNullStr(entity
				.getRearRightChk10()));
		view.setRearRightChk11(StringUtil.transNullStr(entity
				.getRearRightChk11()));
		/******************************/
		/** 九、右后翼子板检测 **/
		view.setFenderRaChk1(StringUtil.transNullStr(entity.getFenderRaChk1()));
		view.setFenderRaChk2(StringUtil.transNullStr(entity.getFenderRaChk2()));
		view.setFenderRaChk3(StringUtil.transNullStr(entity.getFenderRaChk3()));
		view.setFenderRaChk4(StringUtil.transNullStr(entity.getFenderRaChk4()));
		view.setFenderRaChk5(StringUtil.transNullStr(entity.getFenderRaChk5()));
		view.setFenderRaChk6(StringUtil.transNullStr(entity.getFenderRaChk6()));
		/******************************/
		/** 十、正后面检测 **/
		view.setRightAsternChk1(StringUtil.transNullStr(entity
				.getRightAsternChk1()));
		view.setRightAsternChk2(StringUtil.transNullStr(entity
				.getRightAsternChk2()));
		view.setRightAsternChk3(StringUtil.transNullStr(entity
				.getRightAsternChk3()));
		view.setRightAsternChk4(StringUtil.transNullStr(entity
				.getRightAsternChk4()));
		view.setRightAsternChk5(StringUtil.transNullStr(entity
				.getRightAsternChk5()));
		view.setRightAsternChk6(StringUtil.transNullStr(entity
				.getRightAsternChk6()));
		/******************************/
		/** 十一、行李箱内侧检测 **/
		view.setLuggageChk1(StringUtil.transNullStr(entity.getLuggageChk1()));
		view.setLuggageChk2(StringUtil.transNullStr(entity.getLuggageChk2()));
		view.setLuggageChk3(StringUtil.transNullStr(entity.getLuggageChk3()));
		view.setLuggageChk4(StringUtil.transNullStr(entity.getLuggageChk4()));
		view.setLuggageChk5(StringUtil.transNullStr(entity.getLuggageChk5()));
		view.setLuggageChk6(StringUtil.transNullStr(entity.getLuggageChk6()));
		view.setLuggageChk7(StringUtil.transNullStr(entity.getLuggageChk7()));
		view.setLuggageChk8(StringUtil.transNullStr(entity.getLuggageChk8()));
		view.setLuggageChk9(StringUtil.transNullStr(entity.getLuggageChk9()));
		view.setLuggageChk10(StringUtil.transNullStr(entity.getLuggageChk10()));
		/******************************/
		/** 十二、左后翼子板检测 **/
		view.setFenderLaChk1(StringUtil.transNullStr(entity.getFenderLaChk1()));
		view.setFenderLaChk2(StringUtil.transNullStr(entity.getFenderLaChk2()));
		view.setFenderLaChk3(StringUtil.transNullStr(entity.getFenderLaChk3()));
		view.setFenderLaChk4(StringUtil.transNullStr(entity.getFenderLaChk4()));
		view.setFenderLaChk5(StringUtil.transNullStr(entity.getFenderLaChk5()));
		view.setFenderLaChk6(StringUtil.transNullStr(entity.getFenderLaChk6()));
		/******************************/
		/** 十三、左后门检测 **/
		view.setRearLeftChk1(StringUtil.transNullStr(entity.getRearLeftChk1()));
		view.setRearLeftChk2(StringUtil.transNullStr(entity.getRearLeftChk2()));
		view.setRearLeftChk3(StringUtil.transNullStr(entity.getRearLeftChk3()));
		view.setRearLeftChk4(StringUtil.transNullStr(entity.getRearLeftChk4()));
		view.setRearLeftChk5(StringUtil.transNullStr(entity.getRearLeftChk5()));
		view.setRearLeftChk6(StringUtil.transNullStr(entity.getRearLeftChk6()));
		view.setRearLeftChk7(StringUtil.transNullStr(entity.getRearLeftChk7()));
		view.setRearLeftChk8(StringUtil.transNullStr(entity.getRearLeftChk8()));
		view.setRearLeftChk9(StringUtil.transNullStr(entity.getRearLeftChk9()));
		view.setRearLeftChk10(StringUtil
				.transNullStr(entity.getRearLeftChk10()));
		view.setRearLeftChk11(StringUtil
				.transNullStr(entity.getRearLeftChk11()));
		/******************************/
		/** 十四、车顶位置 **/
		view.setCarRoofChk1(StringUtil.transNullStr(entity.getCarRoofChk1()));

		return view;
	}

	/**
	 * 
	 * 将存在基本表中的检测信息set到viewhelp中
	 * 
	 * 用于修改页，信息按数据库原装打出
	 * 
	 * @throws TmsDaoException
	 * 
	 */
	private CarNormalDetectViewHelper setUpdateViewhelpFromCarEntity(
			CarNormalDetectViewHelper view, TmsDetectInfo entity)
			throws TmsDaoException {
		// 八大配置，，检测说明
		// view.setChkModel(chkModel)//检测模式
		view.setMileage(String.valueOf(entity.getMileage()));// 表显里程
		view.setCarDescribe(entity.getCarDescribe());// 检测说明
		/******* 八大配置 **********/
		view.setSkylight(String.valueOf(entity.getSkylight()));
		view.setLeatherSeats(String.valueOf(entity.getLeatherSeats()));
		view.setAluminumRim(String.valueOf(entity.getAluminumRim()));
		view.setGpsNavigation(String.valueOf(entity.getGpsNavigation()));
		view.setAutoWindow(String.valueOf(entity.getAutoWindow()));
		view.setAbs(String.valueOf(entity.getAbs()));
		view.setSrsNumber(String.valueOf(entity.getSrsNumber()));
		view.setFourWheelDrive(String.valueOf(entity.getFourWheelDrive()));

		return view;
	}

	/**
	 * 将基本检测信息set到viewhelp中,修改页
	 * 
	 * 数据库数据原装打出
	 * 
	 * @return
	 * @throws TmsDaoException
	 */
	private CarNormalDetectViewHelper setUpdateViewhelpFromDecEntity(
			CarNormalDetectViewHelper view, TmsDetectNormal entity)
			throws TmsDaoException {

		view.setDisasterCars(entity.getDisasterCars());// 事故车
		/** 一、左前门检测 *********/
		view.setFrontLeftChk1(StringUtil
				.transNullStr(entity.getFrontLeftChk1()));
		view.setFrontLeftChk2(StringUtil
				.transNullStr(entity.getFrontLeftChk2()));
		view.setFrontLeftChk3(StringUtil
				.transNullStr(entity.getFrontLeftChk3()));
		view.setFrontLeftChk4(StringUtil
				.transNullStr(entity.getFrontLeftChk4()));
		view.setFrontLeftChk5(StringUtil
				.transNullStr(entity.getFrontLeftChk5()));
		view.setFrontLeftChk6(StringUtil
				.transNullStr(entity.getFrontLeftChk6()));
		view.setFrontLeftChk7(StringUtil
				.transNullStr(entity.getFrontLeftChk7()));
		view.setFrontLeftChk8(StringUtil
				.transNullStr(entity.getFrontLeftChk8()));
		view.setFrontLeftChk9(StringUtil
				.transNullStr(entity.getFrontLeftChk9()));
		/******************************/
		/** 二、内饰检测 **/
		view.setInsideChk1(StringUtil.transNullStr(entity.getInsideChk1()));
		view.setInsideChk2(StringUtil.transNullStr(entity.getInsideChk2()));
		view.setInsideChk3(StringUtil.transNullStr(entity.getInsideChk3()));
		view.setInsideChk4(StringUtil.transNullStr(entity.getInsideChk4()));
		view.setInsideChk5(StringUtil.transNullStr(entity.getInsideChk5()));
		view.setInsideChk6(StringUtil.transNullStr(entity.getInsideChk6()));
		view.setInsideChk7(StringUtil.transNullStr(entity.getInsideChk7()));
		view.setInsideChk8(StringUtil.transNullStr(entity.getInsideChk8()));
		view.setInsideChk9(StringUtil.transNullStr(entity.getInsideChk9()));
		view.setInsideChk10(StringUtil.transNullStr(entity.getInsideChk10()));
		view.setInsideChk11(StringUtil.transNullStr(entity.getInsideChk11()));
		view.setInsideChk12(StringUtil.transNullStr(entity.getInsideChk12()));
		view.setInsideChk13(StringUtil.transNullStr(entity.getInsideChk13()));
		view.setInsideChk14(StringUtil.transNullStr(entity.getInsideChk14()));
		view.setInsideChk15(StringUtil.transNullStr(entity.getInsideChk15()));
		view.setInsideChk16(StringUtil.transNullStr(entity.getInsideChk16()));
		view.setInsideChk17(StringUtil.transNullStr(entity.getInsideChk17()));
		view.setInsideChk18(StringUtil.transNullStr(entity.getInsideChk18()));
		view.setInsideChk19(StringUtil.transNullStr(entity.getInsideChk19()));
		view.setInsideChk20(StringUtil.transNullStr(entity.getInsideChk20()));
		view.setInsideChk21(StringUtil.transNullStr(entity.getInsideChk21()));
		view.setInsideChk22(StringUtil.transNullStr(entity.getInsideChk22()));
		view.setInsideChk23(StringUtil.transNullStr(entity.getInsideChk23()));
		view.setInsideChk24(StringUtil.transNullStr(entity.getInsideChk24()));
		view.setInsideChk25(StringUtil.transNullStr(entity.getInsideChk25()));
		view.setInsideChk26(StringUtil.transNullStr(entity.getInsideChk26()));
		view.setInsideChk27(StringUtil.transNullStr(entity.getInsideChk27()));
		view.setInsideChk28(StringUtil.transNullStr(entity.getInsideChk28()));
		view.setInsideChk29(StringUtil.transNullStr(entity.getInsideChk29()));
		view.setInsideChk30(StringUtil.transNullStr(entity.getInsideChk30()));
		/******************************/
		/** 三、左前翼子板检测 **/
		view.setPanelFenerLhChk1(StringUtil.transNullStr(entity
				.getPanelFenerLhChk1()));
		view.setPanelFenerLhChk2(StringUtil.transNullStr(entity
				.getPanelFenerLhChk2()));
		view.setPanelFenerLhChk3(StringUtil.transNullStr(entity
				.getPanelFenerLhChk3()));
		view.setPanelFenerLhChk4(StringUtil.transNullStr(entity
				.getPanelFenerLhChk4()));
		view.setPanelFenerLhChk5(StringUtil.transNullStr(entity
				.getPanelFenerLhChk5()));
		view.setPanelFenerLhChk6(StringUtil.transNullStr(entity
				.getPanelFenerLhChk6()));
		/******************************/
		/** 四、正前面检测 **/
		view.setDeadAheadChk1(StringUtil
				.transNullStr(entity.getDeadAheadChk1()));
		view.setDeadAheadChk2(StringUtil
				.transNullStr(entity.getDeadAheadChk2()));
		view.setDeadAheadChk3(StringUtil
				.transNullStr(entity.getDeadAheadChk3()));
		view.setDeadAheadChk4(StringUtil
				.transNullStr(entity.getDeadAheadChk4()));
		view.setDeadAheadChk5(StringUtil
				.transNullStr(entity.getDeadAheadChk5()));
		view.setDeadAheadChk6(StringUtil
				.transNullStr(entity.getDeadAheadChk6()));
		/******************************/
		/** 五、发动机舱内检测 **/
		view.setEngineChk1(StringUtil.transNullStr(entity.getEngineChk1()));
		view.setEngineChk2(StringUtil.transNullStr(entity.getEngineChk2()));
		view.setEngineChk3(StringUtil.transNullStr(entity.getEngineChk3()));
		view.setEngineChk4(StringUtil.transNullStr(entity.getEngineChk4()));
		view.setEngineChk5(StringUtil.transNullStr(entity.getEngineChk5()));
		view.setEngineChk6(StringUtil.transNullStr(entity.getEngineChk6()));
		view.setEngineChk7(StringUtil.transNullStr(entity.getEngineChk7()));
		view.setEngineChk8(StringUtil.transNullStr(entity.getEngineChk8()));
		/******************************/
		/** 六、右前翼子板检测 **/
		view.setPanelFenerRhChk1(StringUtil.transNullStr(entity
				.getPanelFenerRhChk1()));
		view.setPanelFenerRhChk2(StringUtil.transNullStr(entity
				.getPanelFenerRhChk2()));
		view.setPanelFenerRhChk3(StringUtil.transNullStr(entity
				.getPanelFenerRhChk3()));
		view.setPanelFenerRhChk4(StringUtil.transNullStr(entity
				.getPanelFenerRhChk4()));
		view.setPanelFenerRhChk5(StringUtil.transNullStr(entity
				.getPanelFenerRhChk5()));
		view.setPanelFenerRhChk6(StringUtil.transNullStr(entity
				.getPanelFenerRhChk6()));
		/******************************/
		/** 七、右前门检测 **/
		view.setFrontRightChk1(StringUtil.transNullStr(entity
				.getFrontRightChk1()));
		view.setFrontRightChk2(StringUtil.transNullStr(entity
				.getFrontRightChk2()));
		view.setFrontRightChk3(StringUtil.transNullStr(entity
				.getFrontRightChk3()));
		view.setFrontRightChk4(StringUtil.transNullStr(entity
				.getFrontRightChk4()));
		view.setFrontRightChk5(StringUtil.transNullStr(entity
				.getFrontRightChk5()));
		view.setFrontRightChk6(StringUtil.transNullStr(entity
				.getFrontRightChk6()));
		view.setFrontRightChk7(StringUtil.transNullStr(entity
				.getFrontRightChk7()));
		view.setFrontRightChk8(StringUtil.transNullStr(entity
				.getFrontRightChk8()));
		view.setFrontRightChk9(StringUtil.transNullStr(entity
				.getFrontRightChk9()));
		view.setFrontRightChk10(StringUtil.transNullStr(entity
				.getFrontRightChk10()));
		view.setFrontRightChk11(StringUtil.transNullStr(entity
				.getFrontRightChk11()));
		view.setFrontRightChk12(StringUtil.transNullStr(entity
				.getFrontRightChk12()));
		view.setFrontRightChk13(StringUtil.transNullStr(entity
				.getFrontRightChk13()));
		/******************************/
		/** 八、右后门检测 **/
		view.setRearRightChk1(StringUtil
				.transNullStr(entity.getRearRightChk1()));
		view.setRearRightChk2(StringUtil
				.transNullStr(entity.getRearRightChk2()));
		view.setRearRightChk3(StringUtil
				.transNullStr(entity.getRearRightChk3()));
		view.setRearRightChk4(StringUtil
				.transNullStr(entity.getRearRightChk4()));
		view.setRearRightChk5(StringUtil
				.transNullStr(entity.getRearRightChk5()));
		view.setRearRightChk6(StringUtil
				.transNullStr(entity.getRearRightChk6()));
		view.setRearRightChk7(StringUtil
				.transNullStr(entity.getRearRightChk7()));
		view.setRearRightChk8(StringUtil
				.transNullStr(entity.getRearRightChk8()));
		view.setRearRightChk9(StringUtil
				.transNullStr(entity.getRearRightChk9()));
		view.setRearRightChk10(StringUtil.transNullStr(entity
				.getRearRightChk10()));
		view.setRearRightChk11(StringUtil.transNullStr(entity
				.getRearRightChk11()));
		/******************************/
		/** 九、右后翼子板检测 **/
		view.setFenderRaChk1(StringUtil.transNullStr(entity.getFenderRaChk1()));
		view.setFenderRaChk2(StringUtil.transNullStr(entity.getFenderRaChk2()));
		view.setFenderRaChk3(StringUtil.transNullStr(entity.getFenderRaChk3()));
		view.setFenderRaChk4(StringUtil.transNullStr(entity.getFenderRaChk4()));
		view.setFenderRaChk5(StringUtil.transNullStr(entity.getFenderRaChk5()));
		view.setFenderRaChk6(StringUtil.transNullStr(entity.getFenderRaChk6()));
		/******************************/
		/** 十、正后面检测 **/
		view.setRightAsternChk1(StringUtil.transNullStr(entity
				.getRightAsternChk1()));
		view.setRightAsternChk2(StringUtil.transNullStr(entity
				.getRightAsternChk2()));
		view.setRightAsternChk3(StringUtil.transNullStr(entity
				.getRightAsternChk3()));
		view.setRightAsternChk4(StringUtil.transNullStr(entity
				.getRightAsternChk4()));
		view.setRightAsternChk5(StringUtil.transNullStr(entity
				.getRightAsternChk5()));
		view.setRightAsternChk6(StringUtil.transNullStr(entity
				.getRightAsternChk6()));
		/******************************/
		/** 十一、行李箱内侧检测 **/
		view.setLuggageChk1(StringUtil.transNullStr(entity.getLuggageChk1()));
		view.setLuggageChk2(StringUtil.transNullStr(entity.getLuggageChk2()));
		view.setLuggageChk3(StringUtil.transNullStr(entity.getLuggageChk3()));
		view.setLuggageChk4(StringUtil.transNullStr(entity.getLuggageChk4()));
		view.setLuggageChk5(StringUtil.transNullStr(entity.getLuggageChk5()));
		view.setLuggageChk6(StringUtil.transNullStr(entity.getLuggageChk6()));
		view.setLuggageChk7(StringUtil.transNullStr(entity.getLuggageChk7()));
		view.setLuggageChk8(StringUtil.transNullStr(entity.getLuggageChk8()));
		view.setLuggageChk9(StringUtil.transNullStr(entity.getLuggageChk9()));
		view.setLuggageChk10(StringUtil.transNullStr(entity.getLuggageChk10()));
		/******************************/
		/** 十二、左后翼子板检测 **/
		view.setFenderLaChk1(StringUtil.transNullStr(entity.getFenderLaChk1()));
		view.setFenderLaChk2(StringUtil.transNullStr(entity.getFenderLaChk2()));
		view.setFenderLaChk3(StringUtil.transNullStr(entity.getFenderLaChk3()));
		view.setFenderLaChk4(StringUtil.transNullStr(entity.getFenderLaChk4()));
		view.setFenderLaChk5(StringUtil.transNullStr(entity.getFenderLaChk5()));
		view.setFenderLaChk6(StringUtil.transNullStr(entity.getFenderLaChk6()));
		/******************************/
		/** 十三、左后门检测 **/
		view.setRearLeftChk1(StringUtil.transNullStr(entity.getRearLeftChk1()));
		view.setRearLeftChk2(StringUtil.transNullStr(entity.getRearLeftChk2()));
		view.setRearLeftChk3(StringUtil.transNullStr(entity.getRearLeftChk3()));
		view.setRearLeftChk4(StringUtil.transNullStr(entity.getRearLeftChk4()));
		view.setRearLeftChk5(StringUtil.transNullStr(entity.getRearLeftChk5()));
		view.setRearLeftChk6(StringUtil.transNullStr(entity.getRearLeftChk6()));
		view.setRearLeftChk7(StringUtil.transNullStr(entity.getRearLeftChk7()));
		view.setRearLeftChk8(StringUtil.transNullStr(entity.getRearLeftChk8()));
		view.setRearLeftChk9(StringUtil.transNullStr(entity.getRearLeftChk9()));
		view.setRearLeftChk10(StringUtil
				.transNullStr(entity.getRearLeftChk10()));
		view.setRearLeftChk11(StringUtil
				.transNullStr(entity.getRearLeftChk11()));
		/******************************/
		/** 十四、车顶位置 **/
		view.setCarRoofChk1(StringUtil.transNullStr(entity.getCarRoofChk1()));

		return view;
	}

}
